package com.kanche.bigbaby.collection.domain;


import com.kanche.bigbaby.collection.StringUtils;

import java.io.Serializable;

/**
 * Created by nealmi on 6/10/14.
 */
public class Photo implements Serializable {
    public static final int COVER_INDEX = 1;
    private String uri;
    private String key;
    private String name;
    private transient String label;
    private String url;
    private transient int placeHolderResourceId;
    private String original;

    public Photo() {
    }

    public Photo(String key, String uri) {
        this.key = key;
        this.uri = uri;
    }

    public Photo(int placeHolderResourceId) {
        this.placeHolderResourceId = placeHolderResourceId;
    }

    public String getKey() {
        if (!StringUtils.hasText(key)) {
            key = name;
        }
        return key;
    }

    public void setKey(String key) {
        this.key = key;
        this.name = key;
    }

    public String getUri() {
        if (!StringUtils.hasText(uri)) {
            uri = url;
        }
        return uri;
    }

    public void setUri(String uri) {
        this.uri = uri;
        this.url = uri;
    }

    public String getLabel() {
        return label;
    }

    public void setLabel(String label) {
        this.label = label;
    }

    public String getUrl() {
        return uri;
    }

    public void setUrl(String url) {
        this.url = url;
        this.uri = url;
    }

    public String getName() {
        return key;
    }

    public void setName(String name) {
        this.name = name;
        this.key = name;
    }

    public int getPlaceHolderResourceId() {
        return placeHolderResourceId;
    }

    public void setPlaceHolderResourceId(int placeHolderResourceId) {
        this.placeHolderResourceId = placeHolderResourceId;
    }

    public String getOriginal() {
        return original;
    }

    public void setOriginal(String original) {
        this.original = original;
    }
}
